<?php
namespace Admin\Controller;

class StudentController extends BaseController {


    public function index() {


        $class_id = I ('request.class_id');
        if (empty($class_id)) $this->error('非法访问');

        $Class = D ('Class');
        $class_name = $Class->getFullClassName($class_id);
        if (empty($class_name)) $this->error('班级不存在');

        $ClassManager = D ('ClassManager');
        $teacher_id = $ClassManager->getTidByCid($class_id);
        if ($teacher_id !== $this->admin['id']) $this->error('你没有权限管理该班级');

        $Student = D ('Student');
        $map['class_id'] = $class_id;

        $limit = \Api\Libs\PageUtil::getLimit(10);
        $page = \Api\Libs\PageUtil::getPageHtml($Student->getCountByWhere($map),10);

        $studentList = $Student->getStudentByWhere($map,$limit);


        $this->assign('studentList',$studentList);
        $this->assign('page',$page);
        $this->display();
    }

}